<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of News_Model
 *
 * @author LimiTed4D
 */
class News_Model extends CI_Model {
    
    function insertNews($news) {
        $this->db->insert('NEWS', $news);
    }
    
    function deleteNews($newsID) {
        $this->db->where('ID', $newsID);
        $this->db->delete('NEWS');
    }
    
    function getAllNews($per_page, $offset)
    {
        $this->db->select('ID, NEWS_NAME, NEWS_PATH');
        $this->db->from('NEWS');
        $this->db->limit($per_page, $offset);
        $query = $this->db->get();

        return $query;

    }
    
    function getNewsByID($newsID) {
        $this->db->from('NEWS');
        $this->db->where('ID', $newsID);
        $query = $this->db->get();

        return $query;
    }
    
    function getNews() {
        $this->db->from('NEWS');
        $query = $this->db->get();

        return $query;
    }
}

?>
